package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
@Table(name = "speed_info", schema = "springboot", catalog = "")
public class SpeedInfo {
    private int speedId;
    private String speedContext;
    private String possibility;
    private Collection<BusinessInfo> businessInfosBySpeedId;

    @Id
    @Column(name = "speed_id")
    public int getSpeedId() {
        return speedId;
    }

    public void setSpeedId(int speedId) {
        this.speedId = speedId;
    }

    @Basic
    @Column(name = "speed_context")
    public String getSpeedContext() {
        return speedContext;
    }

    public void setSpeedContext(String speedContext) {
        this.speedContext = speedContext;
    }

    @Basic
    @Column(name = "possibility")
    public String getPossibility() {
        return possibility;
    }

    public void setPossibility(String possibility) {
        this.possibility = possibility;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SpeedInfo speedInfo = (SpeedInfo) o;
        return speedId == speedInfo.speedId &&
                Objects.equals(speedContext, speedInfo.speedContext);
    }

    @Override
    public int hashCode() {
        return Objects.hash(speedId, speedContext);
    }

    @OneToMany(mappedBy = "speedInfoBySpeedId")
    public Collection<BusinessInfo> getBusinessInfosBySpeedId() {
        return businessInfosBySpeedId;
    }

    public void setBusinessInfosBySpeedId(Collection<BusinessInfo> businessInfosBySpeedId) {
        this.businessInfosBySpeedId = businessInfosBySpeedId;
    }
}
